package com.eshop.config.datasource;

import org.slf4j.LoggerFactory;
import org.slf4j.Logger;

public class DynamicDataSourceContextHolder
{
    public static final Logger log;
    private static final ThreadLocal<String> CONTEXT_HOLDER;
    
    public static void setDataSourceType(final String dsType) {
        DynamicDataSourceContextHolder.log.info("切换到{}数据源", (Object)dsType);
        DynamicDataSourceContextHolder.CONTEXT_HOLDER.set(dsType);
    }
    
    public static String getDataSourceType() {
        return DynamicDataSourceContextHolder.CONTEXT_HOLDER.get();
    }
    
    public static void clearDataSourceType() {
        DynamicDataSourceContextHolder.CONTEXT_HOLDER.remove();
    }
    
    static {
        log = LoggerFactory.getLogger((Class)DynamicDataSourceContextHolder.class);
        CONTEXT_HOLDER = new ThreadLocal<String>();
    }
}
